<!DOCTYPE html>
<html>
  <head>
    <title>suffix tree</title>
  </head>
  <body>
    <pre id="container"></pre>
    <form id="search" action="/search/:q">
      <label for="query">query the tree:</label>
      <input type="text" name="query" id="query">
    </form>

    <script src="lib/jquery-2.1.0.min.js" type="text/javascript"></script>
    <script src="lib/underscore-min.js" type="text/javascript"></script>
    <script src="lib/sugar-min.js" type="text/javascript"></script>
    <script src="suffix_tree.js" type="text/javascript"></script>

    <script>
      var tree = new SuffixTree();
      tree.learn('banana');

      $('#container').html(JSON.stringify(tree, undefined, 2));

      $('#search').submit(function(event) {
        event.preventDefault();
        console.log(tree.search($('#query').val()));
      })
    </script>
  </body>
</html>
